Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Explore] Altered Slice Tag #3668

Merged

Conversation

Mogball
Copy link
Contributor

@Mogball Mogball commented Oct 13, 2017

Based on a suggesting by @mistercrunch in #3617, this PR implements an AlteredSliceTag which is displayed next to the slice title in the explore view when the current controls do not match the saved slice controls:

screen shot 2017-10-13 at 10 57 46 am

Users can click the tag to open a modal summarizing the differences:

screen shot 2017-10-13 at 10 59 48 am

Most importantly, exploring a slice from a dashboard with dashboard filters will show the slice as altered with the applied filters as differences.

Also fixes #3616

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 70.447% when pulling c1ff26f on Mogball:mogball/feature/altered_explore_slice into bad6938 on apache:master.

1 similar comment
@coveralls
Copy link

coveralls commented Oct 13, 2017

Coverage Status

Coverage increased (+0.06%) to 70.447% when pulling c1ff26f on Mogball:mogball/feature/altered_explore_slice into bad6938 on apache:master.

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to this feature!

@@ -145,6 +146,25 @@ class ChartContainer extends React.PureComponent {
};
}

isAltered() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a deep equality function like http://underscorejs.org/#isEqual instead?

}
}

AlteredSliceTag.propTypes = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put propTypes at the top of the file as in most other modules

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what about if the component received origFormData and currentFormData instead, and the logic to check the differences can live in this component here.

differing[fdKey] = { before: bfd[fdKey], after: fd[fdKey] };
}
}
return differing;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect a isSomething method to return a bool by naming conventions, rename the function to something like getDiffs.

} else if (value.constructor === Object) {
return JSON.stringify(value);
}
return value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking the catchall could be a JSON.stringify though I'm not 100 sure of the implications. There's a guarantee that controls' values are always serializable since they make it through the redux store.

// Returns all properties that differ in the
// current form data and the base form data
const fd = this.props.formData || {};
const bfd = (this.props.slice && this.props.slice.form_data) || {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you may want to use the currentFormData as the driver of which keys should exist. slice.form_data may have unused / deprecated keys that don't affect how the slice is rendered...

@Mogball
Copy link
Contributor Author

Mogball commented Oct 17, 2017

Putting getDiffs in AlteredSliceTag means we can unit test it as well!

@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from 28a3fea to 5154c0a Compare October 17, 2017 17:52
@Mogball Mogball closed this Oct 18, 2017
@Mogball Mogball reopened this Oct 18, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 70.819% when pulling 16f175767899dc6af24b5a28bcecf36e6b69abbe on Mogball:mogball/feature/altered_explore_slice into e121a85 on apache:master.

1 similar comment
@coveralls
Copy link

coveralls commented Oct 18, 2017

Coverage Status

Coverage increased (+0.06%) to 70.819% when pulling 16f175767899dc6af24b5a28bcecf36e6b69abbe on Mogball:mogball/feature/altered_explore_slice into e121a85 on apache:master.

@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from 16f1757 to 5154c0a Compare October 30, 2017 06:31
@Mogball Mogball closed this Oct 31, 2017
@Mogball Mogball reopened this Oct 31, 2017
@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from 31a9d5e to 5154c0a Compare October 31, 2017 06:50
@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from 09f333c to 2e83588 Compare November 1, 2017 18:00
@coveralls
Copy link

coveralls commented Nov 1, 2017

Coverage Status

Coverage increased (+0.06%) to 71.332% when pulling 2e83588 on Mogball:mogball/feature/altered_explore_slice into abfa034 on apache:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.332% when pulling 2e83588 on Mogball:mogball/feature/altered_explore_slice into abfa034 on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.332% when pulling 2e83588 on Mogball:mogball/feature/altered_explore_slice into abfa034 on apache:master.

@mistercrunch
Copy link
Member

Ok this is ready to merge upon fixing conflicts.

@coveralls
Copy link

coveralls commented Nov 10, 2017

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling 5301b10 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@coveralls
Copy link

coveralls commented Nov 10, 2017

Coverage Status

Coverage decreased (-0.08%) to 71.376% when pulling e1ba9c50b481ee521d3715581cb5239f4f7bee14 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from e1ba9c5 to c364a40 Compare November 10, 2017 07:31
@Mogball Mogball force-pushed the mogball/feature/altered_explore_slice branch from c364a40 to c7a3c49 Compare November 10, 2017 07:42
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c7a3c49 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

2 similar comments
@coveralls
Copy link

coveralls commented Nov 10, 2017

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c7a3c49 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 71.517% when pulling c7a3c49 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master.

@Mogball
Copy link
Contributor Author

Mogball commented Nov 10, 2017

@mistercrunch done

@mistercrunch mistercrunch merged commit 4d48d5d into apache:master Nov 11, 2017
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
* Added altered tag to explore slice view and fixes apache#3616

* unit tests

* Moved getDiffs logic into AlteredSliceTag

* code style fixs
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Added altered tag to explore slice view and fixes apache#3616

* unit tests

* Moved getDiffs logic into AlteredSliceTag

* code style fixs
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Carry over dashboard filters to explore: empty fields transferred
3 participants